﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Diagnostics;

namespace ClassLibrary1
{
    public class Monitor
    {

        
        //显示整数
        public static void Show()
        {
            int x = 12345;
            long commonSecond;//普通方法耗费的时间
            long objectSecond;//Object方法耗费的时间
            long genericSecond;//泛型方法耗费的时间
            {
                Stopwatch watch = new Stopwatch();
                watch.Start();
                for (int i = 0; i < 500000000; i++)
                {
                    ShowInt(1);
                }
                watch.Stop();
                commonSecond = watch.ElapsedMilliseconds;
            }
            Console.WriteLine("普通方法运行时间:{0}",commonSecond);
        }
        static void ShowInt(int x)
        {
            //Console.WriteLine("整数为:{0}" + x);
        }
        //object类型，效率低下
        static void ShowObject(object obj)
        {
            //Console.WriteLine(obj);
        }
        
        //泛型用法
        static void Show<T>(T t)
        {
            //Console.WriteLine(t.ToString());
        }
    }
}